import React, { Component } from 'react';

class Child extends Component {
   
    // 生命周期
    componentWillMount() {
        console.log('WillMount');
    }
    componentDidMount() {
        console.log('DidMount')
    }
    componentWillReceiveProps(newProps) {
        console.log('willReceiveProps' + newProps.name);
    }
    shouldComponentUpdate() {
        // 调用setState就会更新此方法
        console.log('shouldComponentUpdate');
        return true;
    }
    componentWillUpdate() {
        console.log('componentWillupdate');
    }
    
    render() {
        return (
            <div>
                {this.props.name}
            </div>
        );
    }
}

export default Child;